package containerleran;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Formatter;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import containerleran.StringTest;
public class MainTest {

	/**
	 * @param args
	 */
	public <T> void test(ArrayList<T> al,ArrayList<? extends T> a){
		
	}
	public static void main(String[] args) {
/*		Arrays a = null;
		List c = new ArrayList();
		c.add("hello");
		c.add(11);
		System.out.println(c);
		Set<String> s = new HashSet<String>();
		s.add("helo");
		s.add("think");
		s.add("think");
		System.out.println(s.contains("think"));
		System.out.println(s);
		Map<String,Integer> m = new HashMap<String,Integer>();
		m.put("hello", 001);
		m.put("11", 12);
		System.out.println(m.toString());
		StringTest st = new StringTest();
//		st.m = 0;
		st.test(1);
		System.out.println(Locale.getDefault());
		System.out.println(new String("heknd").toUpperCase(new Locale("de_DE_", "de", "DE")));
		Locale locale = new Locale("");
		locale = Locale.US ;
		*/
		Object o = new String ("tw1");
//		System.out.println(o);
		MyQueue<String> mq = new MyQueue<String>("tw");
//		System.out.println(mq.add("hello"));
		mq.add("kine");
		mq.add("welcome");
//		mq.doPrint();
//		System.out.println(mq.contains(o));
		Iterator<String> it = mq.iterator();
		while(it.hasNext()){
			System.out.println(it.next());
			it.remove();
		}
		ArrayList<String> al = new ArrayList<String>();
		for(String s : "It is a arraylist toString function test".split(" "))
		al.add(s);
		System.out.println(al);
		StringTest st = new StringTest();
		st.Print();
		System.out.println(" hello world ".trim());
		System.out.format("the result is :[ %d]\n", 11);
		Formatter f = new Formatter(System.err);
//		f.format("%s the test id %d\n", "here",10);
		Object [] object = new Object[10];
		object[0]= new String("the object test");
		System.out.println(object[0]);
		try {
			System.out.println(Class.forName("containerleran.StringTest").isInstance(st));
			StringTest st2 = new StringTest();
//			System.out.println(st2.getClass().getName());
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		Object obj = null;
		try {
		     obj = Class.forName("containerleran.StringTest").newInstance();
		} catch (InstantiationException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		if(obj instanceof Object);
		System.out.println(obj.getClass().getName());
		GenericClass<Integer> gc = new GenericClass<Integer>(5,new Integer[]{10,23,1,2,5});
//		GenericClass<int> gc = new GenericClass<int>(5);
		// can not use int as the the generic type parameter
		//gc.id = 1; here I hava no right to change the value of id
		System.out.println(gc.id);//but I can read the value of id
		gc.testE(7);
		Iterator it2 = gc.retIterator();
		while(it2.hasNext()){
			System.out.println(it2.next());
		}
	}

}
